package com.digital.smartgrow.controller.expert;

import com.digital.smartgrow.common.advice.Result;
import com.digital.smartgrow.entity.expert.ExpertChoose;
import com.digital.smartgrow.service.expert.ExpertChooseService;
import com.digital.smartgrow.vo.expert.ExpertGroupVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 专家抽选表 前端控制器
 * </p>
 *
 * @author sunyuechao
 * @since 2022-07-18
 */
//@Api(tags = "专家抽选表")
//@RestController
//@RequestMapping("${context.prefix}/syc/expertChoose")
public class ExpertChooseController {

    @Autowired
    private ExpertChooseService expertChooseService;
//
//    @ApiOperation(value = "专家抽选表-分页查询")
//    @PostMapping("/list")
//    public Object getListByPage(@RequestBody ExpertChoosePageDTO expertChoosePageDTO){
//        return expertChooseService.getListByPage(expertChoosePageDTO);
//    }

    @ApiOperation(value = "专家抽选表-详情")
    @GetMapping("/{id}")
    public Object getInfo(@PathVariable Integer id){
        if (id == null) return Result.fail("id不能为空");
        return expertChooseService.getInfo(id);
    }

    @ApiOperation(value = "专家抽选表-删除")
    @DeleteMapping("/{id}")
    public Object removeById(@PathVariable Integer id){
      if (id == null) return Result.fail("id不能为空");
      return expertChooseService.removeById(id);
    }
    @ApiOperation(value = "专家抽选表-新增")
    @PostMapping()
    public Object add( @RequestBody ExpertChoose expertChoose){
       return expertChooseService.save(expertChoose);
    }

    @ApiOperation(value = "专家抽选表-编辑")
    @PutMapping()
    public Object edit(@RequestBody ExpertChoose expertChoose){
    if (expertChoose==null||expertChoose.getId() == null)
       return Result.fail("id不能为空");
       return expertChooseService.updateById(expertChoose);
    }





}
